package cn.com.wdjedu.androidapp.wjeduandroid.mvp.introduce;

import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.mvputils.BasePresenter;
import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.mvputils.RxSubscribe;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by CCY on 2017/2/15.
 */

public class introducePresenter extends BasePresenter<introduceview> {

    private introduceDao introDao;

    public introducePresenter(introduceview view) {
        attach(view);
        introDao=new introduceDao();
    }

    public void queryIntroduceData(int groupId){
        mView.showLoading();
        subscription=introDao.queryCourseData(groupId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new RxSubscribe<introduceBean>() {
                    @Override
                    public void _onNext(introduceBean introBean) {
                        if (mView!=null){
                            mView.queryNewIntroduceData(introBean);
                        }
                    }

                    @Override
                    public void _onError(String message) {
                        showError(message);
                    }
                });
    }


}
